<template>
	<div>
		<el-card class="box-card">
			<div class="Serach_b">
				<el-input type="input" autosize placeholder="请输入用户ID" v-model="fy.memberId"
					@keyup.enter.native="seachEnter" style="width: 300px;margin-left: 20px;">
				</el-input>
				<el-cascader :options="options" @change="handleChange"></el-cascader>
				<el-button type="primary" icon="el-icon-search" @click="SearchData()">搜索</el-button>
			</div>
			<el-table :data="PointsMaList" border>
				<el-table-column prop="memberId" label="用户ID" />
				<el-table-column prop="score" label="积分数" />
				<el-table-column prop="orderGram" label="克数" />
				<el-table-column prop="stayScore" label="待释放积分" />
				<el-table-column prop="stayOrderGram" label="待释放克数" />
				<el-table-column prop="surplusScore" label="结余积分" />
				<el-table-column label="来源">
					<template slot-scope="scope">
						<span v-if="scope.row.datasrc == 1">订单</span>
						<span v-if="scope.row.datasrc == 2">评价</span>
						<span v-if="scope.row.datasrc == 3">签到</span>
						<span v-if="scope.row.datasrc == 4">固定释放</span>
						<span v-if="scope.row.datasrc == 5">直推释放</span>
						<span v-if="scope.row.datasrc == 6">团队释放</span>
						<span v-if="scope.row.datasrc == 7">克数</span>
					</template>
				</el-table-column>
				<el-table-column label="积分标识">
					<template slot-scope="scope">
						<span v-if="scope.row.identification == 1">收入</span>
						<span v-if="scope.row.identification == 2">支出</span>
					</template>
				</el-table-column>
				<el-table-column label="积分类型">
					<template slot-scope="scope">
						<span v-if="scope.row.pointsType == 1">待释放静态积分</span>
						<span v-if="scope.row.pointsType == 2">冻结静态积分</span>
						<span v-if="scope.row.pointsType == 3">静态积分</span>
						<span v-if="scope.row.pointsType == 4">待释放动态积分</span>
						<span v-if="scope.row.pointsType == 5">冻结动态积分</span>
						<span v-if="scope.row.pointsType == 6">动态积分</span>
						<span v-if="scope.row.pointsType == 7">冻结签到积分</span>
						<span v-if="scope.row.pointsType == 8">签到积分</span>
						<span v-if="scope.row.pointsType == 9">冻结管理积分</span>
						<span v-if="scope.row.pointsType == 10">管理积分</span>
					</template>
				</el-table-column>
				<el-table-column prop="dataid" label="来源订单号" width="100px" />
				<el-table-column prop="dataremarks" label="描述" />
				<el-table-column prop="createTime" label="创建时间" />
				<el-table-column prop="releaseTime" label="释放日期" />
			</el-table>
			<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[5, 10]"
				:page-size="fy.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
			</el-pagination>
		</el-card>
	</div>
</template>

<script>
	import * as PointsApi from "@/api/Search";
	import {
		timestampToTime
	} from "@/utils/date";
	export default {
		data() {
			return {
				timestampToTime,
				fy: {
					size: 5,
					current: 1,
				},
				total: 0,
				PointsMaList: [],
				options: [{
						label: "全部",
						value: 0,
					},
					{
						label: "收入",
						value: 1,
					},
					{
						label: "支出",
						value: 2,
					},
				],
			};
		},
		methods: {
			handleChange(value) {
				this.fy.identification = value[0];
			},
			SearchData() {
				PointsApi.InsertSysMemberPoints(this.fy).then((res) => {
					this.total = res.data.total;
					this.PointsMaList = res.data.records;
				});
			},
			handleSizeChange(value) {
				this.fy.size = value;
				this.SearchData();
			},
			handleCurrentChange(value) {
				this.fy.current = value;
				this.SearchData();
			},
		},
		created() {
			this.SearchData();
		},
	};
</script>

<style lang="scss" scoped>
	.el-pagination {
		margin-top: 10px;
	}

	.box-card {
		width: 95%;
		margin: auto;
	}

	.Serach_b {
		display: flex;
		align-items: center;
		margin-bottom: 20px;
	}

	.Serach_b .el-button {
		margin-left: 20px;
	}

	.el-textarea {
		margin-left: 20px;
		width: 30%;
	}

	.el-input {
		width: 20%;
		margin-left: 20px;
	}

	.el-cascader {
		width: 20%;
		margin-left: 20px;
	}
</style>
